//
//  DBTableViewCell.m
//  The_news
//
//  Created by dlios on 15/7/19.
//  Copyright (c) 2015年 chenlin. All rights reserved.
//

#import "DBTableViewCell.h"
#import "Header.h"
#import "UIImageView+WebCache.h"
@implementation DBTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}


- (void)dealloc
{
    [self.ima release];
    [self. title release];
    [self.type release];
    [self.model release];
    [super dealloc];
    
}


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self buildMyCell];
    }
    return  self;
}



- (void)buildMyCell
{

    float wei = self.frame.size.width;
    float hei = self.frame.size.height;
     self.ima = [[[UIImageView alloc]initWithFrame:CGRectMake(0, 0,hei  , hei)]autorelease];

    [self addSubview:self.ima];
    
    
    self.title = [[[UILabel alloc]initWithFrame:CGRectMake(hei, 0, wei - hei , hei * 0.5)]autorelease];
     [self.title setTextColor:[UIColor blackColor]];
    [self.title setText:self.model.title];
    [self.title setFont:[UIFont systemFontOfSize:12]];
    [self addSubview:self.title];
    
    
    self.type = [[[UIImageView alloc]initWithFrame:CGRectMake(hei,  hei * 0.5,20, 20 )]autorelease];
    if (self.model.mediaUrl) {
        [self.type setImage:[UIImage imageNamed:@"media.png"]];
    }
    [self addSubview:self.type];
  
 }
@end
